package com.itheima.stargraph.config;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * TODO
 *
 * @Author mr.wu
 * @Data #{DATE} #{TIME}
 */
@Component
public class OllamaConfig {

    @Value("${ollama.apiUrl}")
    private String apiUrl;

    @Bean
    public OpenAIClient openAIClient(){
        OpenAIClient client = new OpenAIOkHttpClient.Builder()
                .baseUrl(apiUrl)
                .apiKey("sk")
                .build();
        return client;
    }

}
